<?php

use Workerman\Worker;
use Workerman\Lib\Timer;
date_default_timezone_set('PRC');
// 自动加载类
require_once __DIR__ . '/../../vendor/autoload.php';

$dblist = [
    0,26,29,24,25,30,
    2 ,3 ,22,6 ,19,8 ,20,21,
    59,55,52,56,58,53,];
$worker = new Worker();
$worker->name = "ClearTask";
//$worker->count = count($dblist);
$worker->onWorkerStart = function(Worker $worker) {
    Timer::add(60,function() {
        if (date('H:i', time()) == '06:00') {
            Game\Services\ClearService::getInstance()->clearRoom();
        }
    });
//for ($i = 0; $i< count($dblist); $i++){
//    if ($worker->id == $i) {
//        Game\Services\ClearService::getInstance()->clearRoom($dblist[$i]);
//    }
//}

};
// 运行worker
Worker::runAll();